#include <getopt.h>

#include <string>

#include "EventLoop.h"
#include "HttpServer.h"

int main(int argc, char* argv[]) {
  int threadNum = 6;
  int port = 8088;

  // parse args
  int opt;
  const char* str = "t:p:";
  while ((opt = getopt(argc, argv, str)) != -1) {
    switch (opt) {
      case 't': {
        threadNum = atoi(optarg);
        break;
      }
      case 'p': {
        port = atoi(optarg);
        break;
      }
      default:
        break;
    }
  }
  EventLoop mainLoop;
  HttpServer myHTTPServer(&mainLoop, threadNum, port);
  myHTTPServer.start();
  mainLoop.loop();
  return 0;
}
